using DapperExtensionsNew.Data;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace DapperExtensionsNew
{
    public interface IRepository<T>
    {
        int Insert(T obj);

        int Insert<TEntity>(TEntity obj);

        TKey Insert<TKey>(T obj);

        TKey Insert<TKey, TEntity>(TEntity obj);

        void InsertBatch<TEntity>(IEnumerable<TEntity> entities);

        int Update(T obj, IEnumerable<string> updateFields = null);

        int Update<TEntity>(TEntity obj, IEnumerable<string> updateFields = null);

        int Delete(object id, string opName = "", bool isDelete = false);

        int Delete<TEntity>(object id, string opName = "", bool isDelete = false);

        int DeleteList(object whereConditions, string opName = "", bool isDelete = false);

        int DeleteList<TEntity>(object whereConditions, string opName = "", bool isDelete = false);

        int DeleteList(string conditions, object parameters = null, string opName = "", bool isDelete = false);

        int DeleteList<TEntity>(string conditions, object parameters = null, string opName = "", bool isDelete = false);

        T Get(object id, bool useMaster = false);

        TEntity Get<TEntity>(object id, bool useMaster = false);

        IEnumerable<T> GetList(object whereConditions, bool useMaster = false);

        IEnumerable<TEntity> GetList<TEntity>(object whereConditions, bool useMaster = false);

        IEnumerable<T> GetList(string conditions, object parameters = null, bool useMaster = false);

        IEnumerable<TEntity> GetList<TEntity>(string conditions, object parameters = null, bool useMaster = false);

        PagedEntity<T> GetListPaged(int pageNumber, int pageSize, string conditions, string orderby, object parameters = null, bool useMaster = false);

        PagedEntity<TEntity> GetListPaged<TEntity>(int pageNumber, int pageSize, string conditions, string orderby, object parameters = null, bool useMaster = false);

        int RecordCount(string conditions, object parameters = null, bool useMaster = false);

        int RecordCount<TEntity>(string condition, object parameters = null, bool useMaster = false);

        int RecordCount(object whereConditions, bool useMaster = false);

        int RecordCount<TEntity>(object whereConditions, bool useMaster = false);

        Task<T> GetAsync(object id, bool useMaster = false);

        Task<TEntity> GetAsync<TEntity>(object id, bool useMaster = false);

        Task<IEnumerable<T>> GetListAsync(object whereConditions, bool useMaster = false);

        Task<IEnumerable<TEntity>> GetListAsync<TEntity>(object whereConditions, bool useMaster = false);

        Task<IEnumerable<T>> GetListAsync(string conditions, object parameters = null, bool useMaster = false);

        Task<IEnumerable<TEntity>> GetListAsync<TEntity>(string conditions, object parameters = null, bool useMaster = false);

        Task<PagedEntity<T>> GetListPagedAsync(int pageNumber, int pageSize, string conditions, string orderby, object parameters = null, bool useMaster = false);

        Task<PagedEntity<TEntity>> GetListPagedAsync<TEntity>(int pageNumber, int pageSize, string conditions, string orderby, object parameters = null, bool useMaster = false);

        Task<int> InsertAsync(T obj);

        Task<int> InsertAsync<TEntity>(TEntity obj);

        Task<TKey> InsertAsync<TKey>(T obj);

        Task<TKey> InsertAsync<TKey, TEntity>(TEntity obj);

        Task InsertBatchAsync<TEntity>(IEnumerable<TEntity> entities);

        Task<int> UpdateAsync(T obj, IEnumerable<string> updateFields = null);

        Task<int> UpdateAsync<TEntity>(TEntity obj, IEnumerable<string> updateFields = null);

        Task<int> DeleteAsync(object id, string opName = "", bool isDelete = false);

        Task<int> DeleteAsync<TEntity>(object id, string opName = "", bool isDelete = false);

        Task<int> DeleteListAsync(object whereConditions, string opName = "", bool isDelete = false);

        Task<int> DeleteListAsync<TEntity>(object whereConditions, string opName = "", bool isDelete = false);

        Task<int> DeleteListAsync(string conditions, object parameters = null, string opName = "", bool isDelete = false);

        Task<int> DeleteListAsync<TEntity>(string conditions, object parameters = null, string opName = "", bool isDelete = false);

        Task<int> RecordCountAsync(string conditions, object parameters = null, bool useMaster = false);

        Task<int> RecordCountAsync<TEntity>(string conditions, object parameters = null, bool useMaster = false);

        Task<int> RecordCountAsync(object whereConditions, bool useMaster = false);

        Task<int> RecordCountAsync<TEntity>(object whereConditions, bool useMaster = false);

        Task<IEnumerable<T>> SelectAsync(IQuery<T> query);
    }
}
